package com.example.jobback.controller.manager;

import com.example.jobback.aspect.RateLimit;
import com.example.jobback.resp.manager.company.page.MCrossGetPageCompanyListResp;
import com.example.jobback.resp.manager.company.register.RecruiterRegisterResp;
import com.example.jobback.resp.manager.employee.page.recruiter.MCrossGetPageRecruitersResp;
import com.example.jobback.result.Result;
import com.example.jobback.service.manager.ManagerCompanyService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

/**
 * @ClassName: ManagerCompanyController
 * @Description:管理员-公司管理控制器
 * @Author: lhb
 * @Date: 2025/6/21
 */
@RestController
@RequestMapping("/manager/company")
@Tag(name = "管理员-公司管理控制器",description = "管理员公司管理服务的相关接口")
public class ManagerCompanyController {


    private final ManagerCompanyService managerCompanyService;

    public ManagerCompanyController(ManagerCompanyService managerCompanyService) {
        this.managerCompanyService = managerCompanyService;
    }


    @Operation(summary = "审核公司注册",description = "审核招聘端在注册页面注册的公司信息和boss信息")
    @PostMapping("/verifyUserCompanyRegister")
    @ApiResponse(description = "返回token，延时登录态")
    public Result<Object> verifyUserCompanyRegister(@Parameter(description = "加密后的电话号码", required = true)
                                                    @RequestParam String phoneAes){
        return managerCompanyService.verifyUserCompanyRegister(phoneAes);
    }

    @Operation(summary = "获取待审核注册公司的列表",description = "全量查询")
    @GetMapping("/getRecruiterCompanyRegisterLists")
    @ApiResponse(description = "返回审核注册公司响应体列表")
    public Result<Set<RecruiterRegisterResp>> getRecruiterCompanyRegisterLists(){
        return managerCompanyService.getRecruiterCompanyRegisterLists();
    }

    @Operation(summary = "审核公司注册不通过",description = "无")
    @PostMapping("/verifyUserCompanyRegisterFailed")
    @ApiResponse(description = "返回token，延时登录态")
    public Result<Object> verifyUserCompanyRegisterFailed(@Parameter(description = "加密后的电话号码", required = true)
                                                          @RequestParam String phoneAes,
                                                          @Parameter(description = "原因填写", required = true)
                                                          @RequestParam String message){
        return managerCompanyService.verifyUserCompanyRegisterFailed(phoneAes,message);
    }

    @Operation(summary = "获取公司列表",description = "跨服务调用，调用方")
    @ApiResponse(description = "无")
    @GetMapping("/getCompanyList")
    @RateLimit
    public Result<MCrossGetPageCompanyListResp> getCompanyList(@Parameter(description = "页码", required = true)@RequestParam int page,
                                                              @Parameter(description = "每页的数量", required = true)@RequestParam int size,
                                                              @Parameter(description = "搜索内容", required = true)@RequestParam String content){
        return managerCompanyService.getCompanyList(page,size,content);
    }



}
